home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / insdel.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-25  |  6.7 KB  |  186 lines

  1. /* Buffer insertion/deletion and gap motion for XEmacs.
  2.    Copyright (C) 1985-1993 Free Software Foundation, Inc.
  3.    Copyright (C) 1994 Amdahl Corporation.
  4.  
  5. This file is part of XEmacs.
  6.  
  7. XEmacs is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. XEmacs is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with XEmacs; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /* Synched up with: Not in FSF. */
  22.  
  23. #ifndef _XEMACS_INSDEL_H_
  24. #define _XEMACS_INSDEL_H_
  25.  
  26. extern Memind do_marker_adjustment (Memind mpos, Memind from,
  27.                     Memind to, int amount);
  28.  
  29. extern int begin_multiple_change (struct buffer *buf, Bufpos start,
  30.                   Bufpos end);
  31. extern void end_multiple_change (struct buffer *buf, int count);
  32.  
  33. extern void fixup_internal_substring (CONST Bufbyte *nonreloc,
  34.                       Lisp_Object reloc,
  35.                       int offset, int *len);
  36.  
  37. /* In font-lock.c */
  38. extern void font_lock_maybe_update_syntactic_caches (struct buffer *buf,
  39.                              Bufpos start,
  40.                              Bufpos orig_end,
  41.                              Bufpos new_end);
  42. extern void font_lock_buffer_was_killed (struct buffer *buf);
  43.  
  44. /* flags for functions below */
  45.  
  46. #define INSDEL_BEFORE_MARKERS 1
  47. #define INSDEL_NO_LOCKING 2
  48.  
  49. extern void buffer_insert_string_1 (struct buffer *buf, Bufpos pos,
  50.                     CONST Bufbyte *nonreloc, Lisp_Object reloc,
  51.                     Bytecount offset, Bytecount length,
  52.                     int flags);
  53. extern void buffer_insert_raw_string_1 (struct buffer *buf, Bufpos pos,
  54.                     CONST Bufbyte *nonreloc,
  55.                     Bytecount length, int flags);
  56. extern void buffer_insert_lisp_string_1 (struct buffer *buf, Bufpos pos,
  57.                      Lisp_Object str, int flags);
  58. extern void buffer_insert_c_string_1 (struct buffer *buf, Bufpos pos,
  59.                       CONST char *s, int flags);
  60. extern void buffer_insert_emacs_char_1 (struct buffer *buf, Bufpos pos,
  61.                     Emchar ch, int flags);
  62. extern void buffer_insert_c_char_1 (struct buffer *buf, Bufpos pos, char c,
  63.                     int flags);
  64. extern void buffer_insert_from_buffer_1 (struct buffer *buf, Bufpos pos,
  65.                      struct buffer *buf2, Bufpos pos2,
  66.                      Charcount length, int flags);
  67.  
  68. /* Macros for insertion functions that insert at point after markers.
  69.    All of these can GC. */
  70.  
  71. #define buffer_insert_string(buf, nonreloc, reloc, offset, length) \
  72.   buffer_insert_string_1 (buf, -1, nonreloc, reloc, offset, length, 0)
  73. #define buffer_insert_raw_string(buf, string, length) \
  74.   buffer_insert_raw_string_1 (buf, -1, string, length, 0)
  75. #define buffer_insert_c_string(buf, s) \
  76.   buffer_insert_c_string_1 (buf, -1, s, 0)
  77. #define buffer_insert_lisp_string(buf, str) \
  78.   buffer_insert_lisp_string_1 (buf, -1, str, 0)
  79. #define buffer_insert_c_char(buf, c) \
  80.   buffer_insert_c_char_1 (buf, -1, c, 0)
  81. #define buffer_insert_emacs_char(buf, ch) \
  82.   buffer_insert_emacs_char_1 (buf, -1, ch, 0)
  83. #define buffer_insert_from_buffer(buf, b, index, length) \
  84.   buffer_insert_from_buffer_1 (buf, -1, b, index, length, 0)
  85.  
  86. extern void buffer_delete_range (struct buffer *buf, Bufpos from, Bufpos to,
  87.                  int flags);
  88. extern void buffer_replace_char (struct buffer *b, Bufpos pos, Emchar ch,
  89.                  int not_real_change, int force_lock_check);
  90. extern void barf_if_buffer_read_only (struct buffer *buf, Bufpos from,
  91.                       Bufpos to);
  92.  
  93. extern Lisp_Object make_string_from_buffer (struct buffer *buf, Bufpos pos,
  94.                         Charcount length);
  95. extern void init_buffer_text (struct buffer *b);
  96. extern void uninit_buffer_text (struct buffer *b);
  97.  
  98. #ifdef MULE
  99. MAC_DECLARE_EXTERN (Emchar, mactemp_lstream_emchar)
  100. MAC_DECLARE_EXTERN (int, mactemp_lstream_emcint)
  101. extern Emchar Lstream_get_emchar_1 (Lstream *stream, int first_char);
  102. extern int Lstream_fput_emchar (Lstream *stream, Emchar ch);
  103. extern void Lstream_funget_emchar (Lstream *stream, Emchar ch);
  104. #endif
  105.  
  106. #ifdef MULE
  107. # define Lstream_get_emchar(stream)                    \
  108. MAC_BEGIN                                \
  109.   MAC_DECLARE (int, mactemp_lstream_emcint, Lstream_getc (stream))    \
  110.   mactemp_lstream_emcint < 0x80 ? (Emchar) mactemp_lstream_emcint :    \
  111.     Lstream_get_emchar_1 (stream, mactemp_lstream_emcint)        \
  112. MAC_END
  113. # define Lstream_put_emchar(stream, ch)                \
  114. MAC_BEGIN                            \
  115.   MAC_DECLARE (Emchar, mactemp_lstream_emchar, ch)        \
  116.   CHAR_ASCII_P (mactemp_lstream_emchar) ?            \
  117.     Lstream_putc (stream, mactemp_lstream_emchar) :        \
  118.     Lstream_fput_emchar (stream, mactemp_lstream_emchar)    \
  119. MAC_END
  120. # define Lstream_unget_emchar(stream, ch)            \
  121. MAC_BEGIN                            \
  122.   MAC_DECLARE (Emchar, mactemp_lstream_emchar, ch)        \
  123.   CHAR_ASCII_P (mactemp_lstream_emchar) ?            \
  124.     Lstream_ungetc (stream, mactemp_lstream_emchar) :        \
  125.     Lstream_funget_emchar (stream, mactemp_lstream_emchar)    \
  126. MAC_END
  127. #else
  128. # define Lstream_get_emchar(stream) Lstream_getc (stream)
  129. # define Lstream_put_emchar(stream, ch) Lstream_putc (stream, ch)
  130. # define Lstream_unget_emchar(stream, ch) Lstream_ungetc (stream, ch)
  131. #endif
  132.  
  133. #ifdef MULE
  134.  
  135. struct buffer_mule_bufpos_data
  136. {
  137.   Bytind bibeg, biend;
  138.   Bufpos beg, end;
  139.   int charsize;
  140. };
  141.  
  142. #endif
  143.  
  144. struct buffer_change_data
  145. {
  146.   /* multiple change stuff */
  147.   int in_multiple_change;
  148.   Bufpos mc_begin, mc_orig_end, mc_new_end;
  149.   int mc_begin_signaled;
  150.   Charcount begin_unchanged, end_unchanged;
  151.   /* redisplay needs to know if a newline was deleted so its
  152.      incremental-redisplay algorithm will fail */
  153.   int newline_was_deleted;
  154.   Charcount begin_extent_unchanged, end_extent_unchanged;
  155. };
  156.  
  157. /* Number of characters at the beginning and end of the buffer that
  158.    have not changed since the last call to buffer_reset_changes().
  159.    If no changes have occurred since then, both values will be -1.
  160.  
  161.    "Changed" means that the text has changed. */
  162.  
  163. #define BUF_BEGIN_UNCHANGED(buf) ((buf)->changes->begin_unchanged)
  164. #define BUF_END_UNCHANGED(buf) ((buf)->changes->end_unchanged)
  165.  
  166. /* Number of characters at the beginning and end of the buffer that
  167.    have not had a covering extent change since the last call to
  168.    buffer_reset_changes ().  If no changes have occurred since then,
  169.    both values will be -1.
  170.  
  171.    "Changed" means that the extents covering the text have changed. */
  172.  
  173. #define BUF_EXTENT_BEGIN_UNCHANGED(buf) \
  174.   ((buf)->changes->begin_extent_unchanged)
  175. #define BUF_EXTENT_END_UNCHANGED(buf) ((buf)->changes->end_extent_unchanged)
  176.  
  177. #define BUF_NEWLINE_WAS_DELETED(buf) \
  178.   ((buf)->changes->newline_was_deleted)
  179.  
  180. extern void buffer_extent_signal_changed_region (struct buffer *buf,
  181.                          Bufpos start,
  182.                          Bufpos end);
  183. extern void buffer_reset_changes (struct buffer *buf);
  184.  
  185. #endif /* _XEMACS_INSDEL_H_ */
  186.